﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using xKnight.Attacking;
using xKnight.Attacking.CSRF;
using xKnight.Attacking.EncodedXss;
using xKnight.Attacking.SimpleXss;
using xKnight.Attacking.Xss;
using xKnight.Models;

namespace xKnight.Attacking
{
    internal class AttackerAgentFactory
    {
        internal static AttackerAgent Create(AttackingSharedReource attackingSharedResource)
        {
            Attack attack = attackingSharedResource.SharedAttack;
            AttackerAgent agent = null;

            if (attack.AttackType == (int)AttackType.SimpleXss)
            {
                agent = new SimpleXssAttackerAgent(attackingSharedResource);
                return agent;
            }

            if (attack.AttackType == (int)AttackType.EncodedXss)
            {
                agent = new EncodedXssAttackerAgent(attackingSharedResource);
                return agent;
            }

            if (attack.AttackType == (int)AttackType.CSRF)
            {
                agent = new CsrfAttackerAgent(attackingSharedResource);
                return agent;
            }

            throw new InvalidDataException("Invalid Attack Type");
        }
    }
}
